From: Jonas Dreßler Date: Sat, 20 Feb 2021 12:57:51 +0000 (+0100) Subject: keyboard: Don't move focusWindow back down on window grab X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~616^2^2~126 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=95b83575cbadb61967ce56f092e61e097c4fa6d3;p=gnome-shell.git keyboard: Don't move focusWindow back down on window grab I suggested it myself when reviewing https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1668, so here I am reverting that again... The difference between calling _setFocusWindow(null) and simply unsetting the focusWindow is that the former animates the window back to its position before we shifted it up, while the latter simply "lets go of the window". In this case we actually want the latter because after the user grabbed the window, we obviously should not animate it away right underneath the users pointer/finger. To ensure the same mistake doesn't happen again, add a small comment explaining why this code is as it is. Part-of: --- diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 43b4e5d27..023b0484f 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -1275,7 +1275,11 @@ var Keyboard = GObject.registerClass({ this._connectSignal(this._focusTracker, 'position-changed', this._onFocusPositionChanged.bind(this)); this._connectSignal(this._focusTracker, 'window-grabbed', () => { - this._setFocusWindow(null); + // Don't use _setFocusWindow() here because that would move the + // window while the user has grabbed it. Instead we simply "let go" + // of the window. + this._focusWindow = null; + this._focusWindowStartY = null; }); // Valid only for X11 if (!Meta.is_wayland_compositor()) {